<template>
  <vxe-modal
    title="查看设备入库详情"
    v-model="dialogVisible"
    v-if="dialogVisible"
    :loading="loading"
    width="70%" showFooter esc-closable show-zoom resize>

    <div style="height: 83vh; overflow-y: auto;">
      <el-card class="box-card" shadow="never" :body-style="{ padding: '10px',backgroundColor: '#bfcdda' }">
        <!-- 设备基本信息 -->
        <el-card class="box-card" shadow="hover">
          <div slot="header" class="clearfix">
            <span style="font-size: 16px; color: #1890ff;">设备入库基本信息</span>
          </div>
          <el-descriptions class="margin-top" :column="2" size="medium" border
                           :contentStyle="content_style" :labelStyle="label_style">
            <el-descriptions-item>
              <template slot="label">
                <div class="right-align-label">
                  <i class="el-icon-user"></i>
                  入库日期：
                </div>
              </template>
              {{ sbRkData.rkRq }}
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label">
                <div class="right-align-label">
                  <i class="el-icon-user"></i>
                  入库状态：
                </div>
              </template>
              <dict-tag :options="dict.type.sbrk_rkzt" :value="sbRkData.rkZt"/>
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label">
                <div class="right-align-label">
                  <i class="el-icon-user"></i>
                  入库方式：
                </div>
              </template>
              <dict-tag :options="dict.type.sbrk_rkfs" :value="sbRkData.rkFs"/>
            </el-descriptions-item>
            <el-descriptions-item>
              <template slot="label">
                <div class="right-align-label">
                  <i class="el-icon-user"></i>
                  入库人：
                </div>
              </template>
              {{ sbRkData.rkR }}
            </el-descriptions-item>
          </el-descriptions>
        </el-card>
        <br>
        <!-- 设备入库明细 -->
        <el-card class="box-card" shadow="hover" style="min-height: 25vh">
          <div slot="header" class="clearfix">
            <span style="font-size: 16px; color: #1890ff;">设备入库明细</span>
          </div>
          <el-table height="52vh" :header-cell-style="{background:'#d0cece',color:'#000000',fontWeight:'bold'}"
                    :data="sbglSbrkRkmxList">
            <el-table-column label="序号" align="center" type="index" width="50"/>
            <el-table-column align="center" label="设备名称" prop="sbName" width="150" show-overflow-tooltip/>
            <el-table-column align="center" label="单位" prop="dw" width="150" show-overflow-tooltip/>
            <el-table-column align="center" label="规格型号" prop="ggXh" width="150" show-overflow-tooltip/>
            <el-table-column align="center" label="所在项目" prop="szXm" width="150" show-overflow-tooltip/>
            <el-table-column align="center" label="出厂编号" prop="ccBh" width="150" show-overflow-tooltip/>
            <el-table-column align="center" label="自编号" prop="zBh" width="150" show-overflow-tooltip/>
            <el-table-column align="center" label="固定资产编号" prop="gdZcBh" width="150" show-overflow-tooltip/>
            <el-table-column align="center" label="备注" prop="bz" show-overflow-tooltip/>
          </el-table>
        </el-card>

      </el-card>
    </div>
    <div slot="footer" class="dialog-footer dialog-footer-center">
      <el-button @click="dialogVisible=false">关闭</el-button>
    </div>
  </vxe-modal>
</template>
<script>


import {getSbrk} from "@/api/sbrk/sbrk";

export default {
  name: "SbRkXq", //设备入库详情界面
  dicts: ['sbgl_sbdw', 'sbrk_rkzt', 'sbrk_rkfs'],
  data() {
    return {
      sbrkId: null, //设备入库主键ID
      loading: false,
      sbRkData: [], //设备入库基本信息
      sbglSbrkRkmxList: null, //设备入库明细
      dialogVisible: false,
      content_style: {
        // 解决不对齐的问题
        'width': "400px",
        // 排列第二行
        'word-break': 'break-all',
        // 'background-color': '#f3f7ff'
      },
      label_style: {
        // 解决不对齐的问题
        'width': "250px",
        // 排列第二行
        'word-break': 'break-all',
        'background-color': '#F0F8FF'
      },
    };
  },
  created() {
  },
  methods: {
    handleOpen(row) {
      this.loading = true;
      this.sbrkId = row.sbrkId
      this.dialogVisible = true
      this.getSbRkData()
      setTimeout(() => {
        this.loading = false
      }, 1000)
    },
    //获取详情数据
    getSbRkData() {
      const sbrkId = this.sbrkId
      getSbrk(sbrkId).then(res => {
        this.sbRkData = res.data
        this.sbglSbrkRkmxList = res.data.sbglSbrkRkmxList;
      })
    },

  }
};
</script>

<style scoped>
.right-align-label {
  text-align: right;
}

/* 定义表头中特定类名的文本居中 */
.el-table .custom-header .cell {
  text-align: center !important;
}
/* header 头部背景 */
/deep/ .el-card__header {
  padding: 3px 7px 3px;
  min-height: 10px;
  background-color: aliceblue;
}
</style>
